# Contributor: Mehdi Chinoune <mehdi.chinoune@hotmail.com>

_realname=libvss
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=25.0.0
pkgrel=2
pkgdesc="A high level string and text processing library. (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64')
msys2_references=(
  'aur: libvss'
)
license=('spdx:Apache-2.0 WITH LLVM-exception')
url="https://github.com/AdaCore/VSS"
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-gcc-ada"
         "${MINGW_PACKAGE_PREFIX}-xmlada")
makedepends=("${MINGW_PACKAGE_PREFIX}-gprbuild")
source=("https://github.com/AdaCore/VSS/archive/v${pkgver}/libvss-${pkgver}.tar.gz")
sha256sums=('70b3a6a2bfe36470466d6a2ed59e5bbc5451879777ea1759243741d930829f64')

build() {
  [[ -d "${srcdir}"/build-${MSYSTEM} ]] && rm -rf "${srcdir}"/build-${MSYSTEM}
  cp -r "${srcdir}/VSS-${pkgver}" "${srcdir}"/build-${MSYSTEM}
  cd "${srcdir}"/build-${MSYSTEM}

  make PREFIX=${MINGW_PREFIX} BUILD_PROFILE=release build-all-libs
}

package() {
  cd "${srcdir}"/build-${MSYSTEM}

  make DESTDIR="${pkgdir}" PREFIX=${MINGW_PREFIX} install-all-libs

  install -Dm644 "${srcdir}/VSS-${pkgver}/LICENSE.txt" \
    "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
